//
//  WalletSpendingCell.m
//  LuxuryGoods
//
//  Created by DCQ on 2018/8/9.
//  Copyright © 2018年 Future. All rights reserved.
//

#import "WalletSpendingCell.h"
#import "WalletListModel.h"
@interface  WalletSpendingCell()
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *dateLabel;
@property (weak, nonatomic) IBOutlet UILabel *moneyLabel;
@property (weak, nonatomic) IBOutlet UILabel *reasonLabel;

@end
@implementation WalletSpendingCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)setupWalletModel:(WalletInfoModel *)model{
    
  
    NSString * titleStr = [NSString stringWithFormat:@"%@",model.name];
    if (model.order_no) {
        [titleStr stringByAppendingString:[NSString stringWithFormat:@"(订单号:%@)",model.order_no]];
    }
     self.titleLabel.text = titleStr;
     self.dateLabel.text = model.createtime;
    // 0-收入 1-支出
    NSString * symbolStr = @"";
    UIColor * moneyColor;
    if ([model.type integerValue] == 0) {
        symbolStr = @"+";
        moneyColor = UIColorFromRGB(0x26AA51);
    }else if ([model.type integerValue] == 1) {
        symbolStr = @"-";
        moneyColor = UIColorFromRGB(0xFF8D6C);
    }
    self.moneyLabel.text = [NSString stringWithFormat:@"%@￥%@",symbolStr,model.price];
    self.moneyLabel.textColor = moneyColor;
    self.reasonLabel.text = model.cash_info[@"refusal_reason"];
}
@end
